/***************************************************************************
 创建者: 华磊
 开始时间: 2018.8.14
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2017.5.8 类的具体实现代码编写

 ***************************************************************************
 *  @file x.h
 *  功能:
 *
 *                                                                         *
 ***************************************************************************/
#ifndef CANIOCONFIG_H
#define CANIOCONFIG_H
#include "canioconfig.h"
#include <qstring.h>
#include "GeneralDefine.h"
#include "ethercatVendorId.h"

struct IoModuleRegAddressInfo
{
   quint16 diStartAdd;
   quint16 doStartAdd;
   quint16 aiStartAdd;
   quint16 aoStartAdd;

};

/**
 * @brief The CanIoConfig class 配置类
 */
class CanIoConfig
{
public:
    CanIoConfig(QString fileName);


public:
    bool isInitialOkStatus();

    int getParameter(IoModuleRegAddressInfo& regInfoReturn, E_VENDOR_ID &vendorIdReturn);
    int getRegAddressParameter(IoModuleRegAddressInfo &regAddReturn);
    int getVendorId(int& vendorIdReturn);
    int getDiDoCount(int& diCounter,int& doCounter,int& aiCounter, int& aoCounter);


private:

    int readConfigFile(QString fileName);
    int readRegAddressParameter(QString fileName);
    int readVendorId(QString fileName);
    int readCount(QString fileName);


private:
    bool isInitialOk;

    int diCount;
    int doCount;
    int aiCount;
    int aoCount;

    CommunicateParameter comParameter;
    IoModuleRegAddressInfo regAddInfo;
    E_VENDOR_ID vendorId;




};

#endif // CANIOCONFIG_H
